// 引入fs模块
const fs = require('fs');
let username = 'Pony Ma';
let pwd = 666666;
let content = {
  username,
  pwd
}
fs.writeFile('./pony.json', JSON.stringify(content), err => {
  if(err) {
    throw err
  }else {
    console.log('操作完成！');
    fs.readFile('./pony.json', 'utf8', (err, data)=> {
      if(err) {
        throw err
      }else {
        let res = JSON.parse(data);
        if(username == res.username && pwd == res.pwd) {
          console.log('登陆成功！');
        }else {
          console.log('用户名或密码错误！');
        }
      }
    })
  }
})


// let realName = 'Jack';
// let person = {
//   realName
// }
// console.log(666,person.realName);